package com.zx.task.manager.param;

import com.zx.validation.annotation.ParameterValidation;
import com.zx.validation.enums.ValidateRulesEnum;
import com.zx.validation.groups.Create;
import com.zx.validation.groups.Update;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;

/**
 * <p>
 * description: 任务类型参数 <br>
 * create: 2025-10-13 20:15
 * </p>
 *
 * @author zhou  xun
 */
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class TaskTypesParam implements Serializable, Create, Update {
    /**
     * 类型ID
     */
    @ParameterValidation(index = 0, desc = "类型ID", rules = {ValidateRulesEnum.NOT_NULL})
    private String id;

    /**
     * 类型编码
     */
    @ParameterValidation(index = 0, desc = "类型编码", rules = {ValidateRulesEnum.NOT_NULL, ValidateRulesEnum.LENGTH}, length = "1~50")
    private String typeCode;

    /**
     * 类型名称
     */
    @ParameterValidation(index = 0, desc = "类型名称", rules = {ValidateRulesEnum.NOT_NULL, ValidateRulesEnum.LENGTH}, length = "1~100")
    private String typeName;

    /**
     * 类型描述
     */
    @ParameterValidation(index = 0, desc = "类型描述", rules = {ValidateRulesEnum.NULL_LENGTH}, length = "0~200")
    private String description;

    /**
     * 显示颜色
     */
    @ParameterValidation(index = 0, desc = "显示颜色", rules = {ValidateRulesEnum.NULL_LENGTH}, length = "0~20")
    private String color;

    /**
     * 显示顺序
     */
    @ParameterValidation(index = 0, desc = "显示顺序", rules = {ValidateRulesEnum.NOT_NULL, ValidateRulesEnum.NUMBER_MIN}, numberMin = 0)
    private Integer seqNo;

    /**
     * 状态(0停用 1正常)
     */
    @ParameterValidation(index = 0, desc = "状态", rules = {ValidateRulesEnum.NOT_NULL})
    private Integer status;

    /**
     * 创建者
     */
    private String createBy;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新者
     */
    private String updateBy;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 备注
     */
    @ParameterValidation(index = 0, desc = "备注", rules = {ValidateRulesEnum.NULL_LENGTH}, length = "0~200")
    private String remark;

    @Override
    public Set<String> getCreateGroupFields() {
        return Set.of("typeCode", "typeName", "description", "color", "seqNo", "status", "remark");
    }

    @Override
    public Set<String> getUpdateGroupFields() {
        return Set.of("id", "typeCode", "typeName", "description", "color", "seqNo", "remark");
    }
}